<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/index.css">
</head>

<body>

    <div class="container">
        <p class="pull-left">
            <a href="/addnote">添加笔记</a>
        </p>

        <p class="pull-right">
            <%if(username){%>

                <div class="pull-right">
                    <span>你好&nbsp;<%=username%>&nbsp;
                    </span>
                    <a href="/center">个人中心</a>
                    <a href="/logout">退出登陆</a>
                </div>
                <%}else{%>
                    <div class="pull-right">
                        <a href="/login">登陆</a>
                        <a href="/register">注册</a>
                    </div>
                    <%}%>
        </p>
        <table class="table table-hover">
            <% data.forEach(item=>{%>
                <tr>
                    <td><a href="/content?id=<%=item._id%>">
                            <%=item.title%>
                        </a></td>
                    <td><span>
                            <%=item.time%>
                        </span></td>
                    <td>
                        <a href="/update?id=<%=item._id%>">编辑</a>

                    </td>
                    <td>
                        <a href="/delnote/<%=item._id%>">删除</a>

                    </td>
                </tr>
                <%})%>

        </table>
    </div>

</body>

</html>